-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow the use of arbitrary Pyodide versions #2002
base: main
Are you sure you want to change the base?
Allow the use of arbitrary Pyodide versions #2002
Conversation
The Windows test failures are unrelated. I'll try to fix them later in the day, but happy to step back if someone else does it before me, or wishes to. |
To correct my above comment - I was confused about the version of pyodide-build versus pyodide itself - it seems that the option CIBW_PYODIDE_VERSION is still necessary, but that the ability to configure the package pyodide-build might also be useful, though is better done through CIBW_DEPENDENCY_VERSIONS. |
It looks like the next step here is to make CIBW_PYODIDE_VERSION a proper option, with documentation. Would you like assistance with that @agriyakhetarpal ? I can certainly help with the options spec/parsing bit, though I think you might be better placed to do the documentation bit, there might be nuance/guidance I'm unaware of. |
# Conflicts: # cibuildwheel/pyodide.py # docs/options.md # docs/setup.md
This removes the enscripten and pyodide-build version specs from pyproject.toml - pyodide-build is spec'd in the constraints file, and the emscripten version can be read from the pyodide-build output.
I've pushed a change to make the option read properly through Still to do -
|
Added docs and tests. Ideas welcome for a way to test pyodide-version itself! Ideally we'd assert that the package is built with the specific version. That said I'm happy enough with the current coverage. @agriyakhetarpal, I hope you don't mind me taking a run at this! I was reviewing it again and found myself forming opinions about how the versions are pinned, so I wanted to see if it worked. Another thing that I noticed is that pyodide version updates aren't automated yet. |
Hi @joerick, thank you so much! Also, apologies for the radio silence here – I couldn't take a look in January, but I'm happy to see it through! #2122 looks like it was a beneficial improvement. I have a few comments that we should take a look at. I haven't gone through the new code changes you pushed fully, so I apologise if these have already been resolved in some form. Here are the primary blockers on this PR that I had previously noticed when I was working on it more actively late last year:
|
I think @ryanking13's plan is that we will relax this, in the sense that we will continue supporting Python 3.12 in pyodide-build even after we upgrade to using Python 3.13. But what does always need to be guaranteed is that target Python version == build Python version. So if we're building a wheel with abi tag |
Ah, interesting. I didn't know that! This isn't too tricky, I think. The way I'd suggest to approach this is to read the python version we need from Previously we've avoided using 3rd-party distributions of CPython, for fear of producing binaries with poor compatibility, but in this case we only need it to run the build, there's no implicit linking going on, right?
In cibuildwheel lingo, this would amount to putting the Pyodide version into the build identifier. Aside: we don't actually do this for PyPy, we're only building the latest PyPy version per Python minor version, even if there are multiple PyPy ABIs within each minor. That doesn't mean we couldn't do it for Pyodide.
I've been skimming @hoodmane's draft PEP 776 re. emscripten. Wouldn't a
If that's the case, (i.e. a 1:1 mapping between Python minor version and wheel ABI) I think keeping the build identifier tied to the Python minor version should suffice. Please correct me if I'm missing something though! |
That's correct, we do not need to worry about patch python versions. |
Yes, exactly. |
If a package uses numpy or scipy at build time, it may be sensitive to the specific Pyodide version and not just the Python minor version. But only insofar as it depends on a specific numpy/scipy version, and this dependency should be clear from its |
That's right, if |
Yes, assuming that we first determine the |
Thanks for the responses @hoodmane and Pyodide folks! So I think the next thing to do would be to remove the implicit reliance on the host Python version, perhaps with python-build-standalone. That can be a follow-up PR, no need to add that here.
That's cool, I was speaking hypothetically, as in, "once the ABI is stable".
Just so I understand this- is that because pyodide bundles these libraries? And is this just a build-time concern or would that also limit the compatibility of the built wheels? |
Yes.
I don't think it should limit compatibility of the built wheels beyond what they already say in their |
Based on these recent discussions, here's what I understand and propose:
|
Description
This PR updates the Pyodide build procedure (see #1456) that is enabled with
CIBW_PLATFORM: "pyodide"
(or with the--platform pyodide
CLI equivalent) post the changes in pyodide/pyodide#4882, wherepyodide/pyodide-build
was unvendored from the main Pyodide repository to accommodate faster updates and fixes.This means that the Pyodide version and
pyodide-build
are not going to be in sync going forward, and that the Pyodide xbuildenv to install must be inferred by the versions available to install bypyodide-build
through a recently addedpyodide xbuildenv search
command, which prints out this table:Tap to expand table
Alternatively, one may use
pyodide xbuildenv search --all
to return both compatible and non-compatible versions. This would, however, be better received as JSON (please see pyodide/pyodide-build#28).Additionally, in this PR, support has been added for installing arbitrary Pyodide versions, or, more specifically, arbitrary versions for "Pyodide cross-build environments (xbuildenvs)" – though, only the ones that are supported for a given
pyodide-build
version. This has been implemented through an environment variableCIBW_PYODIDE_VERSION
and an associated configuration variable in the schema (through a table implemented via pyodide/pyodide-build#26).The rationale behind this is that WebAssembly/Pyodide builds are already experimental, and it would be useful to not tie the available Pyodide version to the
cibuildwheel
version – this would be helpful for downstream projects (statsmodels/statsmodels#9343, scikit-image/scikit-image#7525, scikit-learn/scikit-learn#29791, and so on) to allow testing against Pyodide's alpha releases and/or for the case of greater reproducibility against Pyodide's older releases.cc: @hoodmane and @ryanking13 for visibility
Suggested CHANGELOG entry
Since I didn't find a way to add an entry without the pre-commit hook removing previous entries, I've added a few lines here based on the current state of this PR. Please feel free to suggest changes or modify these lines directly.